﻿function SetMapUrl(mapUrl) {
    var largeMapUrl = mapUrl.substring(0, mapUrl.lastIndexOf("&"));
    htmlBuffer = '<table id="tblHeader" style="margin-left: 5px; text-align: center;" width="98%">';
    htmlBuffer = htmlBuffer + '<tbody>';
    htmlBuffer = htmlBuffer + '<tr style="text-align: right;">';
    htmlBuffer = htmlBuffer + '<td colspan="2">';
    htmlBuffer = htmlBuffer + '<a id="popupDetailClose" href="javascript:HidePopup(1);">Close</a>';
    htmlBuffer = htmlBuffer + '</td>';
    htmlBuffer = htmlBuffer + '</tr>';
    htmlBuffer = htmlBuffer + '<tr>';
    htmlBuffer = htmlBuffer + '<td colspan="2">';
    htmlBuffer = htmlBuffer + '<iframe id="gmapFrame" width="640" height="450" frameborder="0" scrolling="no" marginheight="0"';
    htmlBuffer = htmlBuffer + 'marginwidth="0" src="' + mapUrl + '">';
    htmlBuffer = htmlBuffer + '</iframe>';
    htmlBuffer = htmlBuffer + '<br />';
    htmlBuffer = htmlBuffer + '<small><a id="aLargeMap" style="color: #0000FF; text-align: left" href="' + largeMapUrl + '">View Larger Map</a></small>';
    htmlBuffer = htmlBuffer + '</td>';
    htmlBuffer = htmlBuffer + '</tr>';
    htmlBuffer = htmlBuffer + '</tbody>';
    htmlBuffer = htmlBuffer + '</table>';
    $("#dialog").html(htmlBuffer);
    $("#dialog").css({ height: "490px ", width: "52%", top: "5%", left: "25%" });
}

function ShowUserDetailPopup(detailsUrl) {	
    htmlBuffer = '<table id="tblHeader" style="margin-left: 5px; text-align: center;" width="98%">';
    htmlBuffer = htmlBuffer + '<tbody>';
    htmlBuffer = htmlBuffer + '<tr style="text-align: right;">';
    htmlBuffer = htmlBuffer + '<td colspan="2">';
    htmlBuffer = htmlBuffer + '<a id="popupDetailClose, jqmClose" href="javascript:HidePopup(2);">Close</a>';
    htmlBuffer = htmlBuffer + '</td>';
    htmlBuffer = htmlBuffer + '</tr>';
    htmlBuffer = htmlBuffer + '<tr>';
    htmlBuffer = htmlBuffer + '<td colspan="2">';
    htmlBuffer = htmlBuffer + '<div id="divloading">Please wait..<img src="indicator.gif" alt="loading" /></div>';
    htmlBuffer = htmlBuffer + '<iframe id="userDetailsFrame" width="100%" height="550" frameborder="0" scrolling="yes" marginheight="0"';
    htmlBuffer = htmlBuffer + 'marginwidth="0" src="' + detailsUrl + '">';
    htmlBuffer = htmlBuffer + '</iframe>';
    htmlBuffer = htmlBuffer + '</td>';
    htmlBuffer = htmlBuffer + '</tr>';
    htmlBuffer = htmlBuffer + '</tbody>';
    htmlBuffer = htmlBuffer + '</table>';
    $("#dialog").html(htmlBuffer);

    $("#dialog").css({ height: "98%", width: "40%", top: "5px", left: "30%" });
    $('iframe#userDetailsFrame').load(function() {
        $("#divloading").fadeOut("fast");
    });
}

//*** Hide Modal popup using jQuery ***
function HidePopup(flag) {
    if (flag == 1)
        $("#dialog").jqmHide();
    else if (flag == 2)
        $("#dialog").jqmHide();
}